/* eslint-disable prettier/prettier */

/**
 * !--------- FBI WARNING ----------!
 *
 * 根据 /packages 目录下的组件所生成的组件类侧边导航栏配置，请勿手动修改
 */

import { createRouter, createWebHashHistory, RouterOptions } from 'vue-router';
import { defaultRoutes } from './doc/defaultRouter';

const routes = defaultRoutes.concat([
  {
    title: '按钮',
    name: 'Button',
    path: '/components/Button',
    component: () => import('packages/Button/docs/README.md'),
  },
  {
    title: '测试组件',
    name: 'Test',
    path: '/components/Test',
    component: () => import('packages/Test/docs/README.md'),
  },
  {
    title: '测试组件二',
    name: 'Test2',
    path: '/components/Test2',
    component: () => import('packages/Test2/docs/README.md'),
  },
  {
    title: '数据表格',
    name: 'TnDataTable',
    path: '/components/TnDataTable',
    component: () => import('packages/TnDataTable/docs/README.md'),
  },
  {
    title: '搜索框',
    name: 'SearchInput',
    path: '/components/SearchInput',
    component: () => import('packages/SearchInput/docs/README.md'),
  },
  {
    title: '文字缩略显示',
    name: 'Tooltips',
    path: '/components/Tooltips',
    component: () => import('packages/Tooltips/docs/README.md'),
  },
]);

const routerConfig = {
  history: createWebHashHistory(),
  routes,
  scrollBehavior(to: any, from: any) {
    if (to.path !== from.path) {
      return { top: 0 };
    }
  },
};

const router = createRouter(routerConfig as RouterOptions);

export default router;
